<template>
  <div>
    <!--    <div>-->
    <!--      <img :src="item"  v-for="(item,index) in imageNameList" style="width: 10px;height: 10px">-->
    <!--    </div>-->
    <el-form :inline="true" :model="selectSystemMenu" class="demo-form-inline" ref="selectSystemMenu">
      <el-form-item label="菜单名称">
        <el-input v-model="selectSystemMenu.menuName" placeholder="请输入菜单名称"></el-input>
      </el-form-item>
      <el-form-item label="菜单状态">
        <el-select v-model="selectSystemMenu.status" placeholder="请选择菜单状态">
          <el-option :label="item.dictLabel" :value="item.dictValue" v-for="item in sysNormalDisableDictDataList"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">查询</el-button>
        <el-button @click="resetForm('selectSystemMenu')">重置</el-button>
      </el-form-item>
    </el-form>
    <el-button @click="openAddSysMenuFormDialog(null)" type="primary" icon="el-icon-plus">新增</el-button>
    <el-table
        :data="systemMenuTree"
        style="width: 100%;"
        row-key="menuId"
        :header-row-style="{height:'30px'}"
        :header-cell-style="{background:'#f5f7fa',padding:'0px'}"
        :row-style="{height:'30px'}"
        :cell-style="{padding:'0px'}"
        size="medium"
        :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
        v-loading="loading"
    >
      <el-table-column
          prop="menuName"
          label="菜单名称"
          sortable
          width="180">
      </el-table-column>
      <el-table-column
          prop="icon"
          label="图标">
        <template slot-scope="scope">
          <img :src="getUrl(scope.row.icon)" style="width: 20px;height: 20px"
               v-if="scope.row.icon!=null&&scope.row.icon!=''&&scope.row.icon!='#'">
        </template>
      </el-table-column>
      <el-table-column
          prop="orderNum"
          label="排序">
      </el-table-column>
      <el-table-column
          prop="perms"
          label="权限标识">
      </el-table-column>
      <el-table-column
          prop="component"
          label="组件路径">
      </el-table-column>
      <el-table-column
          prop="status"
          label="状态">
        <template slot-scope="scope">
          <label v-for="item in sysNormalDisableDictDataList" v-if="item.dictValue==scope.row.status">{{item.dictLabel}}</label>
        </template>
      </el-table-column>
      <el-table-column
          prop="createTime"
          label=创建时间
          width="200px">
        <template slot-scope="scope" v-if="scope.row.createTime">
          {{ scope.row.createTime.replace("T", " ") }}
        </template>
      </el-table-column>
      <el-table-column
          fixed="right"
          label="操作"
          width="200px">
        <template slot-scope="scope">
         <span style="margin-right: 15px">
           <i class="el-icon-edit"></i>
           <el-button @click="openUpdateSysMenu(scope.row)" type="text" size="small">修改</el-button>
         </span>
          <span style="margin-right: 15px">
          <i class="el-icon-plus"></i>
          <el-button @click="openAddSysMenuFormDialog(scope.row)" type="text" size="small">新增</el-button>
             </span>
          <span style="margin-right: 15px">
          <i class="el-icon-delete"></i>
          <el-button @click="deleteSysMenu(scope.row)" type="text" size="small">删除</el-button>
             </span>
        </template>
      </el-table-column>
    </el-table>
    <!-- 添加系统菜单对话框 -->
    <el-dialog top="2vh" title="添加菜单" :visible.sync="addSystemMenuDialogFormVisible" width="600px">
      <el-form :model="systemMenu" label-width="80px" :rules="rules" :ref="systemMenu">
        <el-form-item label="上级菜单" :label-width="formLabelWidth" :span="24">
          <el-cascader style="width: 100%"
                       v-model="systemMenu.parentId"
                       :options="systemMenuTreeWithRoot"
                       clearable
                       :props="{emitPath:false,value:'menuId',label:'menuName',checkStrictly:'true',}"
                       @change="handleChange"></el-cascader>
        </el-form-item>
        <el-form-item label="菜单类型" :label-width="formLabelWidth">
          <el-radio-group v-model="systemMenu.menuType">
            <el-radio label="M">目录</el-radio>
            <el-radio label="C">菜单</el-radio>
            <el-radio label="F">按钮</el-radio>
          </el-radio-group>
        </el-form-item>
        <!--        添加对话框中的  目录-->
        <div v-if="systemMenu.menuType=='M'">
          <el-row>
            <el-col :span="12">
              <el-form-item label="目录图标" :label-width="formLabelWidth">
                <el-select v-model="systemMenu.icon" placeholder="请选择">
                  <el-option
                      v-for="item in imageNameList"
                      :key="item"
                      :label="item"
                      :value="item">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item inline label="菜单名称" :label-width="formLabelWidth" prop="menuName">
                <el-input v-model="systemMenu.menuName" autocomplete="off" placeholder="请输入菜单名称"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item inline label="显示排序" :label-width="formLabelWidth" prop="orderNum">
                <el-input-number v-model="systemMenu.orderNum" controls-position="right" :min="1"
                                 :max="10"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="是否外链" :label-width="formLabelWidth">
                <el-radio v-model="systemMenu.isFrame" :label="0">是</el-radio>
                <el-radio v-model="systemMenu.isFrame" :label="1">否</el-radio>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="路由地址" :label-width="formLabelWidth" prop="path">
                <el-input v-model="systemMenu.path" autocomplete="off" placeholder="请输入路由地址"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="显示状态" :label-width="formLabelWidth">
                <el-radio v-model="systemMenu.visible" v-for="item in sysShowHideDictList" :label="item.dictValue">{{item.dictLabel}}</el-radio>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="菜单状态" :label-width="formLabelWidth">
                <el-radio v-model="systemMenu.status" v-for="item in sysNormalDisableDictDataList" :label="item.dictValue">{{item.dictLabel}}</el-radio>
              </el-form-item>
            </el-col>
            <el-col :span="12">
            </el-col>
          </el-row>
        </div>
        <!--        添加对话框中的菜单-->
        <div v-if="systemMenu.menuType=='C'">
          <div class="flex-container" style="display: flex;justify-content: space-between;flex-wrap: wrap;">
            <el-form-item label="菜单图标" :label-width="formLabelWidth">
              <el-select v-model="systemMenu.icon" placeholder="请选择">
                <el-option
                    v-for="item in imageNameList"
                    :key="item"
                    :label="item"
                    :value="item">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item :label-width="formLabelWidth" label="菜单名称" prop="menuName">
              <el-input v-model="systemMenu.menuName" autocomplete="off" placeholder="请输入菜单名称"></el-input>
            </el-form-item>
            <el-form-item :label-width="formLabelWidth" label="显示排序" prop="orderNum">
              <el-input-number v-model="systemMenu.orderNum" controls-position="right" :min="1"
                               :max="10"></el-input-number>
            </el-form-item>
            <el-form-item label="是否外链" :label-width="formLabelWidth">
              <el-radio v-model="systemMenu.isFrame" :label="0">是</el-radio>
              <el-radio v-model="systemMenu.isFrame" :label="1">否</el-radio>
            </el-form-item>
            <el-form-item label="路由地址" :label-width="formLabelWidth" prop="path">
              <el-input v-model="systemMenu.path" autocomplete="off" placeholder="请输入路由地址"></el-input>
            </el-form-item>
          </div>
          <el-row>
            <el-col :span="12">
              <el-form-item label="组件路径" :label-width="formLabelWidth">
                <el-input v-model="systemMenu.component" autocomplete="off" placeholder="请输入权限表示"></el-input>
              </el-form-item>

            </el-col>
            <el-col :span="12">
              <el-form-item label="权限标识" :label-width="formLabelWidth">
                <el-input v-model="systemMenu.perms" autocomplete="off"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="显示状态" :label-width="formLabelWidth">
                <el-radio v-model="systemMenu.visible" v-for="item in sysShowHideDictList" :label="item.dictValue">{{item.dictLabel}}</el-radio>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="菜单状态" :label-width="formLabelWidth">
                <el-radio v-model="systemMenu.status" v-for="item in sysNormalDisableDictDataList" :label="item.dictValue">{{item.dictLabel}}</el-radio>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="是否缓存" :label-width="formLabelWidth">
                <el-radio v-model="systemMenu.isCache" :label="0">缓存</el-radio>
                <el-radio v-model="systemMenu.isCache" :label="1">不缓存</el-radio>
              </el-form-item>
            </el-col>
          </el-row>
        </div>
        <!--        如果单选框选中的是菜单-->

        <div v-if="systemMenu.menuType=='F'">
          <el-row>
            <el-col :span="12">
              <el-form-item inline label="菜单名称" :label-width="formLabelWidth" prop="menuName">
                <el-input v-model="systemMenu.menuName" autocomplete="off"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item inline label="显示排序" :label-width="formLabelWidth" prop="orderNum">
                <el-input-number v-model="systemMenu.orderNum" controls-position="right" @change="handleChange" :min="1"
                                 :max="10"></el-input-number>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="权限标识" :label-width="formLabelWidth">
                <el-input v-model="systemMenu.perms" autocomplete="off"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
            </el-col>
          </el-row>


        </div>
        <!--如果单选框选中的是按钮--->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="addSystemMenuDialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="addSysMenu">确 定</el-button>
      </div>
    </el-dialog>

    <!-- 修改系统菜单对话框 -->
    <el-dialog top="2vh" title="修改菜单" :visible.sync="updateSystemMenuDialogFormVisible" width="600px">
      <el-form :model="systemMenu" label-width="80px">
        <el-form-item label="上级菜单" :label-width="formLabelWidth" :span="24">
          <el-cascader style="width: 100%"
                       v-model="systemMenu.parentId"
                       :options="systemMenuTreeWithRoot"
                       clearable
                       :props="{emitPath:false,value:'menuId',label:'menuName',checkStrictly:'true',}"
                       @change="handleChange"

          ></el-cascader>
        </el-form-item>
        <el-form-item label="菜单类型" :label-width="formLabelWidth">
          <el-radio-group v-model="systemMenu.menuType">
            <el-radio label="M">目录</el-radio>
            <el-radio label="C">菜单</el-radio>
            <el-radio label="F">按钮</el-radio>
          </el-radio-group>
        </el-form-item>
        <!--        修改菜单对话框中的目录-->
        <div v-if="systemMenu.menuType=='M'">
          <el-row>
            <el-col :span="12">
              <el-form-item label="菜单图标" :label-width="formLabelWidth">
                <el-select v-model="systemMenu.icon" placeholder="请选择">
                  <el-option
                      v-for="item in imageNameList"
                      :key="item"
                      :label="item"
                      :value="item">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item inline label="菜单名称" :label-width="formLabelWidth" prop="menuName">
                <el-input v-model="systemMenu.menuName" autocomplete="off" placeholder="请输入菜单名称"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item inline label="显示排序" :label-width="formLabelWidth" prop="orderNum">
                <el-input-number v-model="systemMenu.orderNum" controls-position="right" :min="1"
                                 :max="10"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="是否外链" :label-width="formLabelWidth">
                <el-radio v-model="systemMenu.isFrame" :label="0">是</el-radio>
                <el-radio v-model="systemMenu.isFrame" :label="1">否</el-radio>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="路由地址" :label-width="formLabelWidth" prop="path">
                <el-input v-model="systemMenu.path" autocomplete="off" placeholder="请输入路由地址"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="显示状态" :label-width="formLabelWidth">
                <el-radio v-model="systemMenu.visible" v-for="item in sysShowHideDictList" :label="item.dictValue">{{item.dictLabel}}</el-radio>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="菜单状态" :label-width="formLabelWidth">
                <el-radio v-model="systemMenu.status" v-for="item in sysNormalDisableDictDataList" :label="item.dictValue">{{item.dictLabel}}</el-radio>
              </el-form-item>
            </el-col>
            <el-col :span="12">
            </el-col>
          </el-row>
        </div>
        <!--  修改菜单对话框中的菜单-->
        <div v-if="systemMenu.menuType=='C'">
          <div class="flex-container" style="display: flex;justify-content: space-between;flex-wrap: wrap;">
            <el-form-item label="目录图标" :label-width="formLabelWidth">
              <el-select v-model="systemMenu.icon" placeholder="请选择">
                <el-option
                    v-for="item in imageNameList"
                    :key="item"
                    :label="item"
                    :value="item">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item :label-width="formLabelWidth" label="菜单名称" prop="menuName">
              <el-input v-model="systemMenu.menuName" autocomplete="off" placeholder="请输入菜单名称"></el-input>
            </el-form-item>
            <el-form-item :label-width="formLabelWidth" label="显示排序" prop="orderNum">
              <el-input-number v-model="systemMenu.orderNum" controls-position="right" :min="1"
                               :max="10"></el-input-number>
            </el-form-item>
            <el-form-item label="是否外链" :label-width="formLabelWidth">
              <el-radio v-model="systemMenu.isFrame" :label='0'>是</el-radio>
              <el-radio v-model="systemMenu.isFrame" :label='1'>否</el-radio>
            </el-form-item>
            <el-form-item label="路由地址" :label-width="formLabelWidth" prop="path">
              <el-input v-model="systemMenu.path" autocomplete="off" placeholder="请输入路由地址"></el-input>
            </el-form-item>

          </div>
          <el-row>
            <el-col :span="12">
              <el-form-item label="组件路径" :label-width="formLabelWidth">
                <el-input v-model="systemMenu.component" autocomplete="off" placeholder="请输入权限表示"></el-input>
              </el-form-item>

            </el-col>
            <el-col :span="12">
              <el-form-item label="权限标识" :label-width="formLabelWidth">
                <el-input v-model="systemMenu.perms" autocomplete="off"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="显示状态" :label-width="formLabelWidth">
                <el-radio v-model="systemMenu.visible" v-for="item in sysShowHideDictList" :label="item.dictValue">{{item.dictLabel}}</el-radio>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="菜单状态" :label-width="formLabelWidth">
                <el-radio v-model="systemMenu.status" v-for="item in sysNormalDisableDictDataList" :label="item.dictValue">{{item.dictLabel}}</el-radio>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="是否缓存" :label-width="formLabelWidth">
                <el-radio v-model="systemMenu.isCache" :label="0">缓存</el-radio>
                <el-radio v-model="systemMenu.isCache" :label="1">不缓存</el-radio>
              </el-form-item>
            </el-col>
          </el-row>
        </div>
        <!--        如果单选框选中的是菜单-->

        <div v-if="systemMenu.menuType=='F'">
          <el-row>
            <el-col :span="12">
              <el-form-item inline label="菜单名称" :label-width="formLabelWidth" prop="menuName">
                <el-input v-model="systemMenu.menuName" autocomplete="off"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item inline label="显示排序" :label-width="formLabelWidth" prop="orderNum">
                <el-input-number v-model="systemMenu.orderNum" controls-position="right" @change="handleChange" :min="1"
                                 :max="10"></el-input-number>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="权限标识" :label-width="formLabelWidth">
                <el-input v-model="systemMenu.perms" autocomplete="off"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
            </el-col>
          </el-row>
        </div>
        <!--如果单选框选中的是按钮--->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="updateSystemMenuDialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="updateSysMenu">确 定</el-button>
      </div>
    </el-dialog>

  </div>
</template>
<script>
export default {
  name: 'system/menu/index',
  data() {
    return {
      // 表格的遮罩
      loading: true,
      data: null,
      //  src/assets/icons/svg 下的所有图片名
      imageNameList: [],
      //规则表单
      ruleForm: {
        //菜单名称
        menuName: '',
        //显示排序
        orderNum: '',
        // 路由地址
        path: '',
      },
      //表单规则
      rules: {
        menuName: [
          {required: true, message: '请输入菜单名称', trigger: 'blur'},
          {min: 3, max: 10, message: '长度在3-10个字符', trigger: 'blur'}
        ],
        orderNum: [
          {required: true, message: '请输入显示排序', trigger: 'blur'},
        ],
        path: [
          {required: true, message: '请输入菜单名称', trigger: 'blur'},
        ]
      },
      //带有根目录的系统菜单树   用于添加和修改系统菜单
      systemMenuTreeWithRoot: null,
      urls: require('@/assets/icons/svg/button.svg'),
      selectSystemMenu: {
        menuName: "",
        status: "0",
      },
      systemMenuTree: null,
      systemMenuList: null,
      addSystemMenuDialogFormVisible: false,
      updateSystemMenuDialogFormVisible: false,
      formLabelWidth: "90px",//form表单输入框的宽度
      systemMenuTreeProps: {
        value: "menuId",
        label: "menuName",
        children: "children",
      },
      systemMenu: {
        menuId: "",
        menuName: "",
        parentId: "",
        orderNum: "",
        path: "",
        component: "",
        isFrame: "",
        isCache: "",
        menuType: "C",
        visible: "",
        status: "",
        perms: "",
        icon: "",
        createBy: "",
        parentMenuName: "",
      },
      // 系统开关字典列表
      sysNormalDisableDictDataList: [],
      // 菜单显示/隐藏字典
      sysShowHideDictList:[],
    }
  },
  methods: {
    loadSystemMenuTree() {
      this.axios.get("/sysMenu/tree")
          .then(result => {
            this.systemMenuTree = result.data.data;
            this.loading = false
          })
    },
    loadSysMenuList() {
      this.axios.get("/sysMenu/list")
          .then(result => {
            this.systemMenuList = result.data.data
          })
    },
    handleNodeClick: function (node) {
      this.systemMenu.parentMenuName = node.menuName;
      this.systemMenu.parentId = node.menuId;
      if (node.id != 0) {
        //this.AccountData.orgId = node.id;
      }
      this.$refs.selectReport.blur()
    },
    //打开添加对话框
    openAddSysMenuFormDialog(row) {
      this.emptySysMenu()
      this.systemMenu.status="0"
      this.systemMenu.visible="0"
      this.systemMenu.isCache=0
      this.systemMenu.path="aaaa"
      this.systemMenu.component="aaaa/index"
      this.systemMenu.perms="aaaa:index"
      this.systemMenu.icon="building"
      this.systemMenu.isFrame=0
      this.systemMenu.menuName="业主管理"
      if (row == null) {
        this.systemMenu.parentId = 0
      } else {
        this.systemMenu.parentId = row.menuId
      }
      this.axios.get("/sysMenu/treeWithRoot")
          .then(result => {
            this.systemMenuTreeWithRoot = result.data.data
            this.addSystemMenuDialogFormVisible = true
          })

    },
    // 添加系统菜单
    addSysMenu() {
      this.axios.post("/sysMenu", this.systemMenu)
          .then(result => {
            this.systemMenu.menuId = ""
            this.addSystemMenuDialogFormVisible = false
            this.loadSysMenuList()
            this.loadSystemMenuTree()
            this.$message({
              message: '添加成功',
              type: 'success'
            });

          })
    },
    // 删除系统菜单
    deleteSysMenu(row) {
      this.axios.delete("/sysMenu/" + row.menuId)
          .then(result => {
            this.loadSystemMenuTree()
            this.$message({
              message: '删除成功',
              type: 'success'
            });
          })
    },
    //打开修改菜单对话框（和添加是一个对话框）
    openUpdateSysMenu(row) {
      this.axios.get("/sysMenu/treeWithRoot")
          .then(result => {
            this.systemMenuTreeWithRoot = result.data.data
            this.updateSystemMenuDialogFormVisible = true
          })
      if (row == null) {
        this.systemMenu.parentId = '0'
      } else {
        this.systemMenu = JSON.parse(JSON.stringify(row))
      }

    },
    //修改系统菜单
    updateSysMenu() {
      this.axios.put("/sysMenu", this.systemMenu)
          .then(result => {
            this.updateSystemMenuDialogFormVisible = false
            this.loadSysMenuList()
            this.loadSystemMenuTree()
            this.$message({
              message: '修改成功',
              type: 'success'
            });
          })
    },
    //模糊查询
    onSubmit() {
      this.axios.get("/sysMenu/tree/condition2?menuName=" + this.selectSystemMenu.menuName + "&status=" + this.selectSystemMenu.status)
          .then(result => {
            this.systemMenuTree = null
            this.$forceUpdate()
            this.systemMenuTree = result.data.data
            this.$forceUpdate()
          })
    },
    //添加下拉框修改事件
    handleChange() {
    },
    //获取svg图片地址
    getUrl(value) {
      return require(`@/assets/icons/svg/${value}.svg`)
    },
    // 清空表单数据
    resetForm(formName) {
      this.selectSystemMenu = {
        menuName: "",
        status: 0,
      }
      this.$refs[formName].resetFields();
    },
    //   根据字典类型名称获取字典数据
    loadDictDataListByDictTypeName() {
      this.axios.get("/sysDictData/getBySysDictTypeName/" + "sys_normal_disable")
          .then(result => {
            this.sysNormalDisableDictDataList = result.data.data
            console.log("----------this.sysNormalDisableDictDataList----------")
            console.log(this.sysNormalDisableDictDataList)
          })
    },

    //   根据字典类型名称获取字典数据
    loadSysShowHideDictListByDictTypeName() {
      this.axios.get("/sysDictData/getBySysDictTypeName/" + "sys_show_hide")
          .then(result => {
            this.sysShowHideDictList = result.data.data
          })
    },
  //   清空单个系统菜单
    emptySysMenu(){
      this.systemMenu= {
            menuId: "",
            menuName: "",
            parentId: "",
            orderNum: "",
            path: "",
            component: "",
            isFrame: "",
            isCache: "",
            menuType: "C",
            visible: "",
            status: "",
            perms: "",
            icon: "",
            createBy: "",
            parentMenuName: "",
      }
    }
  },
  mounted() {
    this.loadSystemMenuTree()
    this.loadSysMenuList()
    // setTimeout(()=>{
    // },1000)
    //拿到src/assets/icons/svg  下的所有svg图片名
    let imgList = []
    const files = require.context("@/assets/icons/svg", true, /\.svg$/).keys()
    files.forEach((e) => {
      //获取网络地址  要保留
      // imgList.push(require("../assets/icons/svg"+e.slice(1)))
      const lastIndex = e.lastIndexOf('.')
      imgList.push(e.substring(2, lastIndex))
    })
    this.imageNameList = imgList

    //   获取菜单状态字典
    this.loadDictDataListByDictTypeName()

    //获取菜单  显示/隐藏  字典
    this.loadSysShowHideDictListByDictTypeName()

  },

}

</script>
<style scoped>
.flex-container .el-form-item {
  width: 280px;
}
</style>